<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"
	import="org.oexam.ostudy.facade.struct.LoggedUserDetails"
	import="org.oexam.ostudy.facade.struct.TestNameAndId"
	import="org.oexam.ostudy.facade.struct.AddAndViewTestsDisplayDetails"
	import="org.oexam.ostudy.facade.struct.TeacherNameAndID"
	import="org.oexam.ostudy.facade.struct.TestSetName"
	import="org.oexam.ostudy.facade.TestSetPages" import="java.util.List"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>View and Add Tests to Test Set</title>
<style type="text/css">
body {
	background-color: silver;
}

menu {
	border-style: solid;
	border-color: black;
	min-width: 700px min-height:    700px
}
</style>
</head>
<body>

	<table style="table-layout: auto; min-width: 700px;">
		<tr bgcolor="gray">
			<td colspan="2"><img src="University.gif"
				style="width: 90px; height: 35px" alt="No Image">
				<h1
					style="font-family: cursive; azimuth: left-side; color: #63382E;">
					EXAMPLE UNIVERSITY</h1> <span
				style="font-stretch: ultra-expanded; color: #63382E; font-family: cursive;">
					University Examination and Learning system </span></td>
			<td style="table-layout: auto; min-width: 100px;">
				<%
					LoggedUserDetails loggedUserDetails = (LoggedUserDetails) session
							.getAttribute("userLoginDetails");
				%> Logged in as, <%=loggedUserDetails.getUserName()%>. <br> <a
				href="Logout">logout</a>
			</td>


		</tr>


		<tr valign="top" style="height: 800px">



			<td style="width: 800px; height: 500px; border: thin;"
				bordercolor="black"><br> <%
 	if ((session.getAttribute("message") != null)) {
 %> <%=(String) session.getAttribute("message")%> <%
 	session.setAttribute("message", null);
 	}
 %> <br> <br> <%
 	int testSetID = Integer.parseInt(request.getParameter("TSID"));

 	AddAndViewTestsDisplayDetails pageDetails = new TestSetPages()
 			.getAllViewAndAddTestDisplayDetails(testSetID);
 %>

				<h4>
					Displaying all tests that are included in the test Set
					<%=pageDetails.getTestSetName().getTestSetName()%></h4>


				<table border="1" style="border: thin;" bordercolor="grey">
					<tr bgcolor="gray">
						<td>Test ID</td>
						<td>Test name</td>
						<td colspan="3">Actions</td>
					</tr>
					<%
						for (TestNameAndId testname : pageDetails.getTestnames()) {

							String sid = Integer.toString(testname.getId());
					%>

					<tr>
						<td><%=sid%></td>
						<td><%=testname.getTestName()%></td>
						<td><a href="ViewAndAddTests?action=deleteTest&TID=<%=sid%>">Delete</a>
						</td>


						<%
							}
						%>
					
				</table> <br> <br> <br>
				<hr>

				<h6>Add a New Test to this set</h6>
				<form method="post" action="ViewAndAddTests?TSID=<%=testSetID%>"
					style="border: thick;">
					<table>
						<tr>
							<td>Name of the Test:</td>
							<td><input type="text" name="testName" size="10"></td>
						</tr>
						<tr>
							<td>Number of Questions in the test:</td>
							<td><input type="text" name="noOfQues" size="3"></td>
						</tr>
						<tr>
							<td>Test Duration (in Minutes) :</td>
							<td><input type="text" name="testDur" size="3"></td>
						</tr>
						<tr>
							<td>Test Date :</td>

							<td><input type="text" name="day" size="2"></td>
						</tr>
						<tr>
							<td>Month:</td>
							<td><input type="text" name="month" size="2"></td>
						</tr>
						<tr>
							<td>Year:</td>
							<td><input type="text" name="year" size="4"></td>
						</tr>
						<tr>
							<td><input type="radio" name="isActive" value="Yes" Checked>
								Yes <input type="radio" name="isActive" value="No"> No</td>
						</tr>
						<tr>
							<td>Select Teacher responsible</td>
							<td><select name="teacher">
									<%
										for (TeacherNameAndID teachname : pageDetails.getTeachernames()) {

											String teachid = Integer.toString(teachname.getTeacherID());
											String teachName = teachname.getTeacherName();
									%>

									<option value="<%=teachid%>"><%=teachName%></option>



									<%
										}
									%>
							</select></td>
						</tr>
						<tr>
							<td><input type="submit" value="Add"></td>
						</tr>
					</table>
				</form>
		<tr>
			<td colspan="3"
				style="background-color: #FFA513; text-align: center;">
				Copyright © 2011 www.exampleuniversity.com. All rights reserved.</td>
		</tr>
	</table>

</body>


</html>